package com.inei.tools;

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;
import org.apache.http.protocol.HTTP;
import org.xmlpull.v1.XmlSerializer;
import com.inei.model.entity.RespuestaCenso;
import com.inei.model.entity.RespuestaCensoWeb;
import android.content.Context;
import android.os.Environment;
import android.util.Xml;

public class Exportar {

	Context context;

	public Exportar(Context context) {
		this.context = context;
	}

	public boolean xml(RespuestaCenso o, List<RespuestaCensoWeb> listaO) {
		File file = null;
		File ruta = null;
		try {
			File root = Environment.getExternalStorageDirectory();
			ruta = new File(root, "/Formato de Evaluacion/");
			if (!ruta.exists()) {
				ruta.mkdirs();
			}
			file = new File(ruta, "FormatoDeEvaluacion" + o.getMarco_id()
					+ ".xml");
			FileOutputStream fos = new FileOutputStream(file);
			XmlSerializer xml = Xml.newSerializer();
			xml.setOutput(fos, HTTP.UTF_8);
			xml.startDocument(HTTP.UTF_8, true);
			xml.startTag("", "script");
			xml.startTag("", "respuesta_censo");

			xml.startTag("", "respuesta_id");
			xml.text("" + o.getRespuesta_id());
			xml.endTag("", "respuesta_id");

			xml.startTag("", "formato_id");
			xml.text("" + o.getFormato_id());
			xml.endTag("", "formato_id");

			xml.startTag("", "marco_id");
			xml.text("" + o.getMarco_id());
			xml.endTag("", "marco_id");

			xml.startTag("", "P4_1S");
			xml.text("" + o.getP4_1S());
			xml.endTag("", "P4_1S");

			xml.startTag("", "P4_1W");
			xml.text("" + o.getP4_1W());
			xml.endTag("", "P4_1W");

			xml.startTag("", "P4_2S");
			xml.text("" + o.getP4_2S());
			xml.endTag("", "P4_2S");

			xml.startTag("", "P4_2W");
			xml.text("" + o.getP4_2W());
			xml.endTag("", "P4_2W");

			xml.startTag("", "P5");
			xml.text("" + o.getP5());
			xml.endTag("", "P5");

			xml.startTag("", "P6_DNI");
			xml.text("" + o.getP6_DNI());
			xml.endTag("", "P6_DNI");

			xml.startTag("", "P6_AP");
			xml.text("" + o.getP6_AP());
			xml.endTag("", "P6_AP");

			xml.startTag("", "P6_AM");
			xml.text("" + o.getP6_AM());
			xml.endTag("", "P6_AM");

			xml.startTag("", "P6_N");
			xml.text("" + o.getP6_N());
			xml.endTag("", "P6_N");

			xml.startTag("", "P7_DNI");
			xml.text("" + o.getP7_DNI());
			xml.endTag("", "P7_DNI");

			xml.startTag("", "P7_AP");
			xml.text("" + o.getP7_AP());
			xml.endTag("", "P7_AP");

			xml.startTag("", "P7_AM");
			xml.text("" + o.getP7_AM());
			xml.endTag("", "P7_AM");

			xml.startTag("", "P7_N");
			xml.text("" + o.getP7_N());
			xml.endTag("", "P7_N");

			xml.startTag("", "D1_F");
			xml.text("" + o.getD1_F());
			xml.endTag("", "D1_F");

			xml.startTag("", "D1_IH");
			xml.text("" + o.getD1_IH());
			xml.endTag("", "D1_IH");

			xml.startTag("", "D1_IM");
			xml.text("" + o.getD1_IM());
			xml.endTag("", "D1_IM");

			xml.startTag("", "D1_FH");
			xml.text("" + o.getD1_FH());
			xml.endTag("", "D1_FH");

			xml.startTag("", "D1_FM");
			xml.text("" + o.getD1_FM());
			xml.endTag("", "D1_FM");

			xml.startTag("", "D1_TM");
			xml.text("" + o.getD1_TM());
			xml.endTag("", "D1_TM");

			xml.startTag("", "D2_F");
			xml.text("" + o.getD2_F());
			xml.endTag("", "D2_F");

			xml.startTag("", "D2_IH");
			xml.text("" + o.getD2_IH());
			xml.endTag("", "D2_IH");

			xml.startTag("", "D2_IM");
			xml.text("" + o.getD2_IM());
			xml.endTag("", "D2_IM");

			xml.startTag("", "D2_FH");
			xml.text("" + o.getD2_FH());
			xml.endTag("", "D2_FH");

			xml.startTag("", "D2_FM");
			xml.text("" + o.getD2_FM());
			xml.endTag("", "D2_FM");

			xml.startTag("", "D2_TM");
			xml.text("" + o.getD2_TM());
			xml.endTag("", "D2_TM");

			xml.startTag("", "D3_F");
			xml.text("" + o.getD3_F());
			xml.endTag("", "D3_F");

			xml.startTag("", "D3_IH");
			xml.text("" + o.getD3_IH());
			xml.endTag("", "D3_IH");

			xml.startTag("", "D3_IM");
			xml.text("" + o.getD3_IM());
			xml.endTag("", "D3_IM");

			xml.startTag("", "D3_FH");
			xml.text("" + o.getD3_FH());
			xml.endTag("", "D3_FH");

			xml.startTag("", "D3_FM");
			xml.text("" + o.getD3_FM());
			xml.endTag("", "D3_FM");

			xml.startTag("", "D3_TM");
			xml.text("" + o.getD3_TM());
			xml.endTag("", "D3_TM");

			xml.startTag("", "D4_F");
			xml.text("" + o.getD4_F());
			xml.endTag("", "D4_F");

			xml.startTag("", "D4_IH");
			xml.text("" + o.getD4_IH());
			xml.endTag("", "D4_IH");

			xml.startTag("", "D4_IM");
			xml.text("" + o.getD4_IM());
			xml.endTag("", "D4_IM");

			xml.startTag("", "D4_FH");
			xml.text("" + o.getD4_FH());
			xml.endTag("", "D4_FH");

			xml.startTag("", "D4_FM");
			xml.text("" + o.getD4_FM());
			xml.endTag("", "D4_FM");

			xml.startTag("", "D4_TM");
			xml.text("" + o.getD4_TM());
			xml.endTag("", "D4_TM");

			xml.startTag("", "E_1");
			xml.text("" + o.getE_1());
			xml.endTag("", "E_1");

			xml.startTag("", "E_2");
			xml.text("" + o.getE_2());
			xml.endTag("", "E_2");

			xml.startTag("", "C2_01");
			xml.text("" + o.getC2_01());
			xml.endTag("", "C2_01");

			xml.startTag("", "C2_02");
			xml.text("" + o.getC2_02());
			xml.endTag("", "C2_02");

			xml.startTag("", "C2_11");
			xml.text("" + o.getC2_11());
			xml.endTag("", "C2_11");

			xml.startTag("", "C2_12");
			xml.text("" + o.getC2_12());
			xml.endTag("", "C2_12");

			xml.startTag("", "C2_13");
			xml.text("" + o.getC2_13());
			xml.endTag("", "C2_13");

			xml.startTag("", "C2_21");
			xml.text("" + o.getC2_21());
			xml.endTag("", "C2_21");

			xml.startTag("", "C2_22");
			xml.text("" + o.getC2_22());
			xml.endTag("", "C2_22");

			xml.startTag("", "C2_23");
			xml.text("" + o.getC2_23());
			xml.endTag("", "C2_23");

			xml.startTag("", "C2_31");
			xml.text("" + o.getC2_31());
			xml.endTag("", "C2_31");

			xml.startTag("", "C2_32");
			xml.text("" + o.getC2_32());
			xml.endTag("", "C2_32");

			xml.startTag("", "C2_33");
			xml.text("" + o.getC2_33());
			xml.endTag("", "C2_33");

			xml.startTag("", "C2_41");
			xml.text("" + o.getC2_41());
			xml.endTag("", "C2_41");

			xml.startTag("", "C2_42");
			xml.text("" + o.getC2_42());
			xml.endTag("", "C2_42");

			xml.startTag("", "C2_43");
			xml.text("" + o.getC2_43());
			xml.endTag("", "C2_43");

			xml.startTag("", "C2_51");
			xml.text("" + o.getC2_51());
			xml.endTag("", "C2_51");

			xml.startTag("", "C2_52");
			xml.text("" + o.getC2_52());
			xml.endTag("", "C2_52");

			xml.startTag("", "C2_53");
			xml.text("" + o.getC2_53());
			xml.endTag("", "C2_53");

			xml.startTag("", "C2_61");
			xml.text("" + o.getC2_61());
			xml.endTag("", "C2_61");

			xml.startTag("", "C2_62");
			xml.text("" + o.getC2_62());
			xml.endTag("", "C2_62");

			xml.startTag("", "C2_63");
			xml.text("" + o.getC2_63());
			xml.endTag("", "C2_63");

			xml.startTag("", "C2_71");
			xml.text("" + o.getC2_71());
			xml.endTag("", "C2_71");

			xml.startTag("", "C2_72");
			xml.text("" + o.getC2_72());
			xml.endTag("", "C2_72");

			xml.startTag("", "C2_73");
			xml.text("" + o.getC2_73());
			xml.endTag("", "C2_73");

			xml.startTag("", "C2_80");
			xml.text("" + o.getC2_80());
			xml.endTag("", "C2_80");

			xml.startTag("", "C2_81");
			xml.text("" + o.getC2_81());
			xml.endTag("", "C2_81");

			xml.startTag("", "C2_82");
			xml.text("" + o.getC2_82());
			xml.endTag("", "C2_82");

			xml.startTag("", "C2_83");
			xml.text("" + o.getC2_83());
			xml.endTag("", "C2_83");

			xml.startTag("", "C2_90");
			xml.text("" + o.getC2_90());
			xml.endTag("", "C2_90");

			xml.startTag("", "C2_91");
			xml.text("" + o.getC2_91());
			xml.endTag("", "C2_91");

			xml.startTag("", "C2_92");
			xml.text("" + o.getC2_92());
			xml.endTag("", "C2_92");

			xml.startTag("", "C2_93");
			xml.text("" + o.getC2_93());
			xml.endTag("", "C2_93");

			xml.startTag("", "C3_1A");
			xml.text("" + o.getC3_1A());
			xml.endTag("", "C3_1A");

			xml.startTag("", "C3_1B");
			xml.text("" + o.getC3_1B());
			xml.endTag("", "C3_1B");

			xml.startTag("", "C3_2A");
			xml.text("" + o.getC3_2A());
			xml.endTag("", "C3_2A");

			xml.startTag("", "C3_2B");
			xml.text("" + o.getC3_2B());
			xml.endTag("", "C3_2B");

			xml.startTag("", "C3_3M");
			xml.text("" + o.getC3_3M());
			xml.endTag("", "C3_3M");

			xml.startTag("", "C3_3IH");
			xml.text("" + o.getC3_3IH());
			xml.endTag("", "C3_3IH");

			xml.startTag("", "C3_3IM");
			xml.text("" + o.getC3_3IM());
			xml.endTag("", "C3_3IM");

			xml.startTag("", "C3_3FH");
			xml.text("" + o.getC3_3FH());
			xml.endTag("", "C3_3FH");

			xml.startTag("", "C3_3FM");
			xml.text("" + o.getC3_3FM());
			xml.endTag("", "C3_3FM");

			xml.startTag("", "C3_OB");
			xml.text("" + o.getC3_OB());
			xml.endTag("", "C3_OB");

			xml.startTag("", "C4_1A");
			xml.text("" + o.getC4_1A());
			xml.endTag("", "C4_1A");

			xml.startTag("", "C4_1B");
			xml.text("" + o.getC4_1B());
			xml.endTag("", "C4_1B");

			xml.startTag("", "C4_2A");
			xml.text("" + o.getC4_2A());
			xml.endTag("", "C4_2A");

			xml.startTag("", "C4_2B");
			xml.text("" + o.getC4_2B());
			xml.endTag("", "C4_2B");

			xml.startTag("", "C4_3M");
			xml.text("" + o.getC4_3M());
			xml.endTag("", "C4_3M");

			xml.startTag("", "C4_3IH");
			xml.text("" + o.getC4_3IH());
			xml.endTag("", "C4_3IH");

			xml.startTag("", "C4_3IM");
			xml.text("" + o.getC4_3IM());
			xml.endTag("", "C4_3IM");

			xml.startTag("", "C4_3FH");
			xml.text("" + o.getC4_3FH());
			xml.endTag("", "C4_3FH");

			xml.startTag("", "C4_3FM");
			xml.text("" + o.getC4_3FM());
			xml.endTag("", "C4_3FM");

			xml.startTag("", "C4_OB");
			xml.text("" + o.getC4_OB());
			xml.endTag("", "C4_OB");

			xml.startTag("", "C5_1A");
			xml.text("" + o.getC5_1A());
			xml.endTag("", "C5_1A");

			xml.startTag("", "C5_1B");
			xml.text("" + o.getC5_1B());
			xml.endTag("", "C5_1B");

			xml.startTag("", "C5_2A");
			xml.text("" + o.getC5_2A());
			xml.endTag("", "C5_2A");

			xml.startTag("", "C5_2B");
			xml.text("" + o.getC5_2B());
			xml.endTag("", "C5_2B");

			xml.startTag("", "C5_3M");
			xml.text("" + o.getC5_3M());
			xml.endTag("", "C5_3M");

			xml.startTag("", "C5_3IH");
			xml.text("" + o.getC5_3IH());
			xml.endTag("", "C5_3IH");

			xml.startTag("", "C5_3IM");
			xml.text("" + o.getC5_3IM());
			xml.endTag("", "C5_3IM");

			xml.startTag("", "C5_3FH");
			xml.text("" + o.getC5_3FH());
			xml.endTag("", "C5_3FH");

			xml.startTag("", "C5_3FM");
			xml.text("" + o.getC5_3FM());
			xml.endTag("", "C5_3FM");

			xml.startTag("", "C5_OB");
			xml.text("" + o.getC5_OB());
			xml.endTag("", "C5_OB");

			xml.startTag("", "C6_1A");
			xml.text("" + o.getC6_1A());
			xml.endTag("", "C6_1A");

			xml.startTag("", "C6_1B");
			xml.text("" + o.getC6_1B());
			xml.endTag("", "C6_1B");

			xml.startTag("", "C6_2A");
			xml.text("" + o.getC6_2A());
			xml.endTag("", "C6_2A");

			xml.startTag("", "C6_2B");
			xml.text("" + o.getC6_2B());
			xml.endTag("", "C6_2B");

			xml.startTag("", "C6_3M");
			xml.text("" + o.getC6_3M());
			xml.endTag("", "C6_3M");

			xml.startTag("", "C6_3IH");
			xml.text("" + o.getC6_3IH());
			xml.endTag("", "C6_3IH");

			xml.startTag("", "C6_3IM");
			xml.text("" + o.getC6_3IM());
			xml.endTag("", "C6_3IM");

			xml.startTag("", "C6_3FH");
			xml.text("" + o.getC6_3FH());
			xml.endTag("", "C6_3FH");

			xml.startTag("", "C6_3FM");
			xml.text("" + o.getC6_3FM());
			xml.endTag("", "C6_3FM");

			xml.startTag("", "C6_OB");
			xml.text("" + o.getC6_OB());
			xml.endTag("", "C6_OB");

			xml.startTag("", "C7_1A");
			xml.text("" + o.getC7_1A());
			xml.endTag("", "C7_1A");

			xml.startTag("", "C7_1B");
			xml.text("" + o.getC7_1B());
			xml.endTag("", "C7_1B");

			xml.startTag("", "C7_2A");
			xml.text("" + o.getC7_2A());
			xml.endTag("", "C7_2A");

			xml.startTag("", "C7_2B");
			xml.text("" + o.getC7_2B());
			xml.endTag("", "C7_2B");

			xml.startTag("", "C7_3M");
			xml.text("" + o.getC7_3M());
			xml.endTag("", "C7_3M");

			xml.startTag("", "C7_3IH");
			xml.text("" + o.getC7_3IH());
			xml.endTag("", "C7_3IH");

			xml.startTag("", "C7_3IM");
			xml.text("" + o.getC7_3IM());
			xml.endTag("", "C7_3IM");

			xml.startTag("", "C7_3FH");
			xml.text("" + o.getC7_3FH());
			xml.endTag("", "C7_3FH");

			xml.startTag("", "C7_3FM");
			xml.text("" + o.getC7_3FM());
			xml.endTag("", "C7_3FM");

			xml.startTag("", "C7_OB");
			xml.text("" + o.getC7_OB());
			xml.endTag("", "C7_OB");

			xml.startTag("", "C7_21A");
			xml.text("" + o.getC7_21A());
			xml.endTag("", "C7_21A");

			xml.startTag("", "C7_21B");
			xml.text("" + o.getC7_21B());
			xml.endTag("", "C7_21B");

			xml.startTag("", "C7_22A");
			xml.text("" + o.getC7_22A());
			xml.endTag("", "C7_22A");

			xml.startTag("", "C7_22B");
			xml.text("" + o.getC7_22B());
			xml.endTag("", "C7_22B");

			xml.startTag("", "C7_23M");
			xml.text("" + o.getC7_23M());
			xml.endTag("", "C7_23M");

			xml.startTag("", "C7_23IH");
			xml.text("" + o.getC7_23IH());
			xml.endTag("", "C7_23IH");

			xml.startTag("", "C7_23IM");
			xml.text("" + o.getC7_23IM());
			xml.endTag("", "C7_23IM");

			xml.startTag("", "C7_23FH");
			xml.text("" + o.getC7_23FH());
			xml.endTag("", "C7_23FH");

			xml.startTag("", "C7_23FM");
			xml.text("" + o.getC7_23FM());
			xml.endTag("", "C7_23FM");

			xml.startTag("", "C7_2OB");
			xml.text("" + o.getC7_2OB());
			xml.endTag("", "C7_2OB");

			xml.startTag("", "C7_31A");
			xml.text("" + o.getC7_31A());
			xml.endTag("", "C7_31A");

			xml.startTag("", "C7_31B");
			xml.text("" + o.getC7_31B());
			xml.endTag("", "C7_31B");

			xml.startTag("", "C7_32A");
			xml.text("" + o.getC7_32A());
			xml.endTag("", "C7_32A");

			xml.startTag("", "C7_32B");
			xml.text("" + o.getC7_32B());
			xml.endTag("", "C7_32B");

			xml.startTag("", "C7_33M");
			xml.text("" + o.getC7_33M());
			xml.endTag("", "C7_33M");

			xml.startTag("", "C7_33IH");
			xml.text("" + o.getC7_33IH());
			xml.endTag("", "C7_33IH");

			xml.startTag("", "C7_33IM");
			xml.text("" + o.getC7_33IM());
			xml.endTag("", "C7_33IM");

			xml.startTag("", "C7_33FH");
			xml.text("" + o.getC7_33FH());
			xml.endTag("", "C7_33FH");

			xml.startTag("", "C7_33FM");
			xml.text("" + o.getC7_33FM());
			xml.endTag("", "C7_33FM");

			xml.startTag("", "C7_3OB");
			xml.text("" + o.getC7_3OB());
			xml.endTag("", "C7_3OB");

			xml.startTag("", "C8_1A");
			xml.text("" + o.getC8_1A());
			xml.endTag("", "C8_1A");

			xml.startTag("", "C8_1B");
			xml.text("" + o.getC8_1B());
			xml.endTag("", "C8_1B");

			xml.startTag("", "C8_2A");
			xml.text("" + o.getC8_2A());
			xml.endTag("", "C8_2A");

			xml.startTag("", "C8_2B");
			xml.text("" + o.getC8_2B());
			xml.endTag("", "C8_2B");

			xml.startTag("", "C8_3M");
			xml.text("" + o.getC8_3M());
			xml.endTag("", "C8_3M");

			xml.startTag("", "C8_3IH");
			xml.text("" + o.getC8_3IH());
			xml.endTag("", "C8_3IH");

			xml.startTag("", "C8_3IM");
			xml.text("" + o.getC8_3IM());
			xml.endTag("", "C8_3IM");

			xml.startTag("", "C8_3FH");
			xml.text("" + o.getC8_3FH());
			xml.endTag("", "C8_3FH");

			xml.startTag("", "C8_3FM");
			xml.text("" + o.getC8_3FM());
			xml.endTag("", "C8_3FM");

			xml.startTag("", "C8_OB");
			xml.text("" + o.getC8_OB());
			xml.endTag("", "C8_OB");

			xml.startTag("", "C9_1A");
			xml.text("" + o.getC9_1A());
			xml.endTag("", "C9_1A");

			xml.startTag("", "C9_1B");
			xml.text("" + o.getC9_1B());
			xml.endTag("", "C9_1B");

			xml.startTag("", "C9_2A");
			xml.text("" + o.getC9_2A());
			xml.endTag("", "C9_2A");

			xml.startTag("", "C9_2B");
			xml.text("" + o.getC9_2B());
			xml.endTag("", "C9_2B");

			xml.startTag("", "C9_3M");
			xml.text("" + o.getC9_3M());
			xml.endTag("", "C9_3M");

			xml.startTag("", "C9_3IH");
			xml.text("" + o.getC9_3IH());
			xml.endTag("", "C9_3IH");

			xml.startTag("", "C9_3IM");
			xml.text("" + o.getC9_3IM());
			xml.endTag("", "C9_3IM");

			xml.startTag("", "C9_3FH");
			xml.text("" + o.getC9_3FH());
			xml.endTag("", "C9_3FH");

			xml.startTag("", "C9_3FM");
			xml.text("" + o.getC9_3FM());
			xml.endTag("", "C9_3FM");

			xml.startTag("", "C9_OB");
			xml.text("" + o.getC9_OB());
			xml.endTag("", "C9_OB");

			xml.startTag("", "C10_1A");
			xml.text("" + o.getC10_1A());
			xml.endTag("", "C10_1A");

			xml.startTag("", "C10_1B");
			xml.text("" + o.getC10_1B());
			xml.endTag("", "C10_1B");

			xml.startTag("", "C10_2A");
			xml.text("" + o.getC10_2A());
			xml.endTag("", "C10_2A");

			xml.startTag("", "C10_2B");
			xml.text("" + o.getC10_2B());
			xml.endTag("", "C10_2B");

			xml.startTag("", "C10_3M");
			xml.text("" + o.getC10_3M());
			xml.endTag("", "C10_3M");

			xml.startTag("", "C10_3IH");
			xml.text("" + o.getC10_3IH());
			xml.endTag("", "C10_3IH");

			xml.startTag("", "C10_3IM");
			xml.text("" + o.getC10_3IM());
			xml.endTag("", "C10_3IM");

			xml.startTag("", "C10_3FH");
			xml.text("" + o.getC10_3FH());
			xml.endTag("", "C10_3FH");

			xml.startTag("", "C10_3FM");
			xml.text("" + o.getC10_3FM());
			xml.endTag("", "C10_3FM");

			xml.startTag("", "C10_OB");
			xml.text("" + o.getC10_OB());
			xml.endTag("", "C10_OB");

			xml.startTag("", "C11_1A");
			xml.text("" + o.getC11_1A());
			xml.endTag("", "C11_1A");

			xml.startTag("", "C11_1B");
			xml.text("" + o.getC11_1B());
			xml.endTag("", "C11_1B");

			xml.startTag("", "C11_2A");
			xml.text("" + o.getC11_2A());
			xml.endTag("", "C11_2A");

			xml.startTag("", "C11_2B");
			xml.text("" + o.getC11_2B());
			xml.endTag("", "C11_2B");

			xml.startTag("", "C11_3M");
			xml.text("" + o.getC11_3M());
			xml.endTag("", "C11_3M");

			xml.startTag("", "C11_3IH");
			xml.text("" + o.getC11_3IH());
			xml.endTag("", "C11_3IH");

			xml.startTag("", "C11_3IM");
			xml.text("" + o.getC11_3IM());
			xml.endTag("", "C11_3IM");

			xml.startTag("", "C11_3FH");
			xml.text("" + o.getC11_3FH());
			xml.endTag("", "C11_3FH");

			xml.startTag("", "C11_3FM");
			xml.text("" + o.getC11_3FM());
			xml.endTag("", "C11_3FM");

			xml.startTag("", "C11_OB");
			xml.text("" + o.getC11_OB());
			xml.endTag("", "C11_OB");

			xml.startTag("", "fecCrea");
			xml.text("" + o.getFecCrea());
			xml.endTag("", "fecCrea");

			xml.startTag("", "fec_modi");
			xml.text("" + o.getFec_modi());
			xml.endTag("", "fec_modi");

			xml.endTag("", "respuesta_censo");

			for (RespuestaCensoWeb ow : listaO) {
				xml.startTag("", "respuesta_censo_web");

				xml.startTag("", "rpta_web_id");
				xml.text("" + ow.getRpta_web_id());
				xml.endTag("", "rpta_web_id");

				xml.startTag("", "respuesta_id");
				xml.text("" + ow.getRespuesta_id());
				xml.endTag("", "respuesta_id");

				xml.startTag("", "W_1");
				xml.text("" + ow.getW_1());
				xml.endTag("", "W_1");

				xml.startTag("", "W_IH");
				xml.text("" + ow.getW_IH());
				xml.endTag("", "W_IH");

				xml.startTag("", "W_IM");
				xml.text("" + ow.getW_IM());
				xml.endTag("", "W_IM");

				xml.startTag("", "W_FH");
				xml.text("" + ow.getW_FH());
				xml.endTag("", "W_FH");

				xml.startTag("", "W_FM");
				xml.text("" + ow.getW_FM());
				xml.endTag("", "W_FM");

				xml.startTag("", "W_MES");
				xml.text("" + ow.getW_MES());
				xml.endTag("", "W_MES");

				xml.startTag("", "W_DIA");
				xml.text("" + ow.getW_DIA());
				xml.endTag("", "W_DIA");

				xml.startTag("", "W_MOTI");
				xml.text("" + ow.getW_MOTI());
				xml.endTag("", "W_MOTI");

				xml.endTag("", "respuesta_censo_web");
			}

			xml.endTag("", "script");
			xml.endDocument();
			fos.close();

		} catch (Exception e) {
			return false;
		}
		return true;
	}

	public String completar(String texto) {
		return "P" + (texto.length() == 1 ? "0" + texto : texto);
	}
}
